pub struct Logger {
    fname: String,
}

impl Logger {
    pub fn new(fname: &str) -> Logger{
        let log = Logger{ fname: fname.to_string() };
        log.init();
        log
    }

    fn init(&self) {
        //TODO: 
        //set the module name 
        println!("TODO: init logger ...");
    }
    pub fn path(&self) -> &str {
        &self.fname
    }
    pub fn set_path(&mut self, fname: &str) {
        if self.fname != fname {
            self.fname = fname.to_string();
        }
    }
}

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn easy_use() {
        let expect_path = "./leveldb-rs.log";

        let mut logger = Logger::new(expect_path);
        assert_eq!(expect_path, logger.path());

        logger.set_path(expect_path);
        assert_eq!(expect_path, logger.path());
    }
}
